home *** CD-ROM | disk | FTP | other *** search
/ Aminet 16 / Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso / Aminet / dev / src / wangisrc.lha / wangi / z / pktcopy / pktcopy.pas < prev   
Pascal/Delphi Source File  |  1996-02-04  |  1KB  |  72 lines

  1. Program Pktcopy;
  2.  
  3. Uses Dos;
  4.  
  5. {$I-}
  6.  
  7. Function ExistsFile(s : String) : Boolean;
  8.  
  9. Var
  10.     f : File;
  11.     
  12. Begin
  13.     Assign(f, s);
  14.     Reset(f);
  15.     If IOResult = 0 Then Begin
  16.         Close(f);
  17.         ExistsFile := True;
  18.     End Else
  19.         ExistsFile := False;
  20. End;
  21.  
  22.  
  23.  
  24. Procedure Main;
  25.  
  26. Var
  27.     pathp : String;
  28.     filep : String;
  29.     extp  : String;
  30.     num   : Integer;
  31.     day   : Integer;
  32.  
  33. Const
  34.     ARG_FROM = 1;
  35.     ARG_To   = 2;
  36.     days : Array[1..7] Of String = ('mo',
  37.                                     'tu',
  38.                                     'we',
  39.                                     'th',
  40.                                     'fr',
  41.                                     'sa',
  42.                                     'su');
  43.  
  44. Begin
  45.     Writeln('1');
  46.     If ParamCount = 2 Then Begin
  47.         Writeln('2');
  48.         If ExistsFile(ParamStr(ARG_To)) Then Begin
  49.             Writeln('3');
  50.             FSplit(ParamStr(ARG_To), pathp, filep, extp);
  51.             num := -1;
  52.             day := 1;
  53.             Repeat
  54.                 if num < 9 Then
  55.                     inc(num)
  56.                 Else Begin
  57.                     num := 0;
  58.                     If day < 7 Then
  59.                         inc(day)
  60.                     Else
  61.                         day := 1;
  62.                 End;
  63.                 Str(num, extp);
  64.                 extp := days[day] + extp;
  65.                 Writeln(pathp + filep + extp);
  66.             Until NOT(ExistsFile(pathp + filep + extp));
  67.         End;
  68.     End;
  69. End;
  70.  
  71.  
  72. Begin main end.